<template>
  <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item :label="label">
        <el-switch v-model="form.flag"></el-switch><span style="margin-left: 15px;">{{ msg }}</span>
        
      </el-form-item>
      <el-form-item>
        <el-button @click="submit">确定</el-button>
        <el-button @click="cancel">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      title: this.titleP,
      label: this.labelP,
      form: { flag: false },
    };
  },
  props: {
    titleP: "",
    labelP: "",
    msgP: "",
    openP: false,
  },
  created() {},
  computed: {
    open: {
      set: function () {
        this.$emit("on-second-confirm", false);
        this.form = { flag: false };
      },
      get: function () {
        return this.openP;
      },
    },
    msg: {
      get: function () {
        return this.msgP;
      },
    },
  },
  methods: {
    submit() {
      this.$emit("on-second-confirm", this.form.flag);
      this.form = { flag: false };
    },
    cancel() {
      this.$emit("on-second-confirm", false);
      this.form = { flag: false };
    },
  },
};
</script>